
public class ThreadTest {
	
	public static void main(String[] args) {
		try {
			while(true) {
				SleepSheep ss = new SleepSheep();
				ss.start();
			}
		} catch (Throwable t) {
			t.printStackTrace();
			System.err.println(SleepSheep.counter);
		}
	}

}

class SleepSheep implements Runnable {
	public  static volatile int counter = 0;
	public void run(){
		counter++ ;
		System.err.println(SleepSheep.counter);
		try {
			Thread.sleep(10000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void start() {
		Thread t = new Thread(this);
		t.start();
	}
}